class AuthenticationController < ApplicationController
  skip_before_action :authenticate_request

  def authenticate
    command = AuthenticateUser.call(params[:email], params[:password])

    if command.success?
     @token = Token.find_by(email: params[:email]) 
     obj_return(@token, status: 200)
    else
     # render json: @resource, status: 401,serializer: ActiveModel::Serializer::ErrorSerializer
     err_return(:unauthorized, status:401)
    end
  end
end
